package com.chinasoft.ssm.mapper;

import com.chinasoft.ssm.pojo.Item;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ItemMapper {
    @Insert("insert into item values(null,#{pron},#{img},#{userId},#{count},#{bikeId},#{cost},#{time})")
    Integer insert(Item bike);
    @Select("select * from item where userId = #{userId} ")
    List<Item> findById(Integer id);
    @Update("update item set  cost=#{cost}, pron = #{pron} , img = #{img}, userId = #{userId},bikeId=#{bikeId},count=#{count},time=#{time}  where id = #{id}  ")
    Integer update(Item bike);
    @Select("select * from item where userId = #{userId} and bikeId = #{bikeId}")
    List<Item> findByBikeId(Integer userId,Integer bikeId);
    @Delete("delete from item where id = #{id} ")
    Integer delete(Integer id);
}
